import useCommonStore from "@/store/modules/common";
const commonStore = useCommonStore();
const attributes_auth = computed(() => {
  if (!commonStore.attributes_auth) {
    commonStore.getAttributesList();
  }
  return commonStore.attributes_auth || [];
});

// 字段权限 有权限显示内容 无权限显示 ** 或者自定义
export const fieldPermission = (auth, value, default_value = '**') => {
  const hasAuth = attributes_auth.value.some((i) => i.value === auth);
  if (hasAuth) {
    return value
  } else {
    return default_value
  }
};

// 字段权限 判断有没有权限
export const fieldPermissionBoolen = (auth) => {
  const hasAuth = attributes_auth.value.some((i) => i.value === auth);
  return hasAuth
};